package com.huawei.appmarket.service.store.awk.card;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import com.huawei.appmarket.service.appdetail.bean.detail.DetailGradeBean;
import com.huawei.appmarket.service.appdetail.bean.report.GeneralResponse;
import com.huawei.appmarket.service.appdetail.bean.report.GeneralResponse.GradeData;
import com.huawei.appmarket.service.appdetail.bean.report.GeneralResponse.GradeInfo;
import com.huawei.appmarket.service.settings.view.activity.GradeListDescriptionActivityProtocol;
import com.huawei.appmarket.service.settings.view.activity.GradeListDescriptionActivityProtocol.Request;
import java.lang.ref.WeakReference;
import o.azb;
import o.cfw;
import o.cgz;
import o.cjk;
import o.cjm;
import o.cjo;
import o.ckt;
import o.cvt;
import o.BaseRequest;
import o.dgh;
import o.dgm;
import o.Logger;
import o.ContentManager;
import o.drh;
import o.CollectCheck;
import o.eqx;
import o.evk;
import o.ewm.j;
import o.ewm.n;

public class DetailGradeGeneralCard extends BaseDistCard implements OnClickListener {
    private TextView ʻ;
    private View ʼ;
    private TextView ʽ;
    private ImageView ˋ;
    private TextView ॱॱ;
    private TextView ᐝ;

    static class c implements IServerCallBack {
        private WeakReference<Activity> ˊ;

        private c(Activity activity) {
            this.ˊ = new WeakReference(activity);
        }

        public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
        }

        public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
            Activity activity = (Activity) this.ˊ.get();
            if (activity != null) {
                if ((responseBean instanceof GeneralResponse) && responseBean.getResponseCode() == 0) {
                    GeneralResponse generalResponse = (GeneralResponse) responseBean;
                    if (generalResponse.getRtnCode_() == 0) {
                        GradeInfo ॱॱ = generalResponse.ॱॱ();
                        if (ॱॱ == null || ॱॱ.ˏ() == null || CollectCheck.isEmpty(ॱॱ.ˏ().ॱ())) {
                            evk.ॱ(ContentManager.getInstant().getContext().getString(n.ॱˉ), 0).ˋ();
                            Logger.ˋ("DetailGradeCardStoreCallBack", " notifyResult gradeInfo is null");
                            return;
                        }
                        GradeData ˏ = ॱॱ.ˏ();
                        cjo gradeListDescriptionActivityProtocol = new GradeListDescriptionActivityProtocol();
                        gradeListDescriptionActivityProtocol.ˊ(new Request());
                        gradeListDescriptionActivityProtocol.ॱ().ˎ(ˏ);
                        cjk.ˎ().ˋ(activity, new cjm("gradedescription.activity", gradeListDescriptionActivityProtocol));
                        return;
                    }
                    evk.ॱ(ContentManager.getInstant().getContext().getString(n.ॱˉ), 0).ˋ();
                    Logger.ˋ("DetailGradeCardStoreCallBack", " notifyResult error res.getRtnCode_()=" + generalResponse.getRtnCode_());
                } else if (ResponseBean.SERVER_DELAY_RETRY == responseBean.getResponseCode()) {
                    evk.ˏ(ContentManager.getInstant().getContext(), n.ˊᵎ, 0).ˋ();
                } else {
                    evk.ॱ(ContentManager.getInstant().getContext().getString(n.ॱˉ), 0).ˋ();
                }
            }
        }
    }

    public /* synthetic */ cgz ˏ(View view) {
        return ˋ(view);
    }

    public DetailGradeGeneralCard(Context context) {
        super(context);
    }

    public DetailGradeGeneralCard ˋ(View view) {
        azb.ˏ(view, j.ʾꜟ);
        this.ˋ = (ImageView) view.findViewById(j.ՙॱ);
        this.ᐝ = (TextView) view.findViewById(j.ߺॱ);
        this.ʽ = (TextView) view.findViewById(j.ـᐝ);
        this.ʻ = (TextView) view.findViewById(j.ʼﾞ);
        this.ॱॱ = (TextView) view.findViewById(j.ـˎ);
        this.ʼ = view.findViewById(j.ߵॱ);
        azb.ˏ(this.ʼ);
        this.ʼ.setClickable(true);
        this.ʼ.setOnClickListener(new ckt(this));
        ((ImageView) view.findViewById(j.יॱ)).setVisibility(0);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        DetailGradeBean detailGradeBean = (DetailGradeBean) cardBean;
        if (detailGradeBean != null && !TextUtils.isEmpty(detailGradeBean.ॱ())) {
            ॱ(detailGradeBean);
            ˏ(this.ᐝ, detailGradeBean.ˊ());
            ˏ(this.ʽ, detailGradeBean.ʽ());
            ˏ(this.ॱॱ, detailGradeBean.ᶥ());
            this.ʻ.setText(detailGradeBean.ॱ());
        }
    }

    public void onClick(View view) {
        if (view == this.ʼ) {
            dgh.ॱ("091101", "action", "click");
            ˋ((Activity) this.ʼ.getContext());
        }
    }

    private void ˋ(Activity activity) {
        cvt o_drh = new drh("grade");
        o_drh.setServiceType_(dgm.ˎ(activity));
        cfw.ˎ(o_drh, new c(activity));
    }

    private void ॱ(DetailGradeBean detailGradeBean) {
        if (this.ˋ == null) {
            return;
        }
        if (TextUtils.isEmpty(detailGradeBean.ꓸ())) {
            this.ˋ.setVisibility(8);
            return;
        }
        this.ˋ.setVisibility(0);
        eqx.ˏ(this.ˋ, detailGradeBean.ꓸ(), "iconflag");
    }

    private void ˏ(TextView textView, String str) {
        if (TextUtils.isEmpty(str)) {
            textView.setVisibility(8);
            return;
        }
        textView.setVisibility(0);
        textView.setText(str);
    }
}
